/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trim.gui.testing;

import java.io.File;
import java.net.URL;

/**
 *
 * @author Дмитрий
 */
public class AppState
{

  public static File CURRENT_FILE=new File(getProgrammDir());
private static PlaginManager plaginManager=new PlaginManager();

  public static PlaginManager getPlaginManager()
  {
    return plaginManager;
  }

  public static void setPlaginManager(PlaginManager plaginManager)
  {
    AppState.plaginManager=plaginManager;
  }

  public static String getCurrentDir()
  {
    String path=System.getProperty("java.class.path");
    String FileSeparator=(String)System.getProperty("file.separator");
    return path.substring(0,path.lastIndexOf(FileSeparator)+1);
  }

  /**
   * Полчение директории из которой запущена программа
   * @return
   */
  public static String getProgrammDir()
  {
    URL pathURL=AppState.class.getProtectionDomain().getCodeSource().getLocation();
    String path=String.valueOf(pathURL);
    path=path.substring(5,path.length()-1);
    path=path.substring(0,path.lastIndexOf("/")+1).replace("/",File.separator);
    return path;
  }
}
